/**
 * 订单管理-订单查询
 * 
 * @author yellow
 */
var queryOrderSearch = function() {
	var queryOrdersFieldSet = new Ext.form.FieldSet({
		id : 'queryOrdersFieldSet',
		title : '查询条件',
		collapsible : true,// 可折叠
		buttonAlign : 'center',
		keys : [{
					key : 13, // 13代表回车
					fn : queryOrders,
					scope : this
				}],
		items : [{
					layout : 'column',
					border : false,
					items : [{
								columnWidth : .25,
								layout : 'form',
								border : false,
								items : [{
											xtype : 'textfield',
											anchor : '100%',
											fieldLabel : '注册手机号',
											name : "userMobileNo"
										}]
							}, {
								columnWidth : .25,
								layout : 'form',
								border : false,
								items : [{
											xtype : 'textfield',
											anchor : '100%',
											fieldLabel : '收货人手机号',
											name : "consignPhone"
										}]
							}, {
								columnWidth : .25,
								layout : 'form',
								border : false,
								items : [{
											xtype : 'textfield',
											anchor : '100%',
											fieldLabel : '收货人',
											name : "consignee"
										}]
							}, {
								columnWidth : .25,
								layout : 'form',
								border : false,
								items : [{
											xtype : 'textfield',
											anchor : '100%',
											fieldLabel : '收货人地址',
											name : "consignAddress"
										}]
							}]
				}, {
					layout : 'column',
					border : false,
					items : [{
								columnWidth : .25,
								layout : 'form',
								border : false,
								items : [{
											id : 'orderManager_id',
											xtype : 'numberfield',
											anchor : '100%',
											fieldLabel : '订单编号',
											name : "id",
											allowDecimals : false,
											allowNegative : false
										}]
							}, {
								columnWidth : .25,
								layout : 'form',
								border : false,
								items : [{
											id : "orderManager_orderCode",
											xtype : 'textfield',
											anchor : '100%',
											fieldLabel : '订单编码',
											name : "orderCode"
										}]
							}, {
								columnWidth : .25,
								layout : 'form',
								border : false,
								items : [{
											id : 'orderManager_orderStatusMultiCmb',
											xtype : 'dataDictionaryMultiCmb',
											anchor : '100%',
											fieldLabel : "订单状态",
											editable : false,
											autoLoad : false,
											hiddenValueId : 'orderManager_orderStatus',
											dictionaryType : PmsUtil.order_status
										}]
							}, {
								id : 'orderManager_orderStatus',
								xtype : 'hidden',
								name : 'orderStatusIds'
							}, {
								columnWidth : .25,
								layout : 'form',
								border : false,
								items : [{
											id : 'orderManager_payTypesMultiCmb',
											xtype : 'dataDictionaryMultiCmb',
											anchor : '100%',
											fieldLabel : "支付方式",
											editable : false,
											autoLoad : false,
											hiddenValueId : 'orderManager_payType',
											dictionaryType : PmsUtil.orders_pay_type
										}]
							}, {
								id : 'orderManager_payType',
								xtype : 'hidden',
								name : 'payTypes'
							}]
				}, {
					layout : 'column',
					border : false,
					items : [{
						columnWidth : .25,
						layout : 'form',
						border : false,
						items : [{
							xtype : "datetimefield",
							id : "orderManager_startDate",
							name : "orderCreateStartDate",
							anchor : "100%",
							fieldLabel : "创建开始日期",
							// value : getYesterdayDate(),
							editable : false,
							listeners : {
								'select' : function() {
									Ext.getCmp('orderManager_endDate')
											.setMinValue(this.getValue());
								}
							}
						}]
					}, {
						columnWidth : .25,
						layout : 'form',
						border : false,
						items : [{
							xtype : "datetimefield",
							id : "orderManager_endDate",
							name : "orderCreateEndDate",
							fieldLabel : "创建结束日期",
							anchor : "100%",
							// value : getTodayDate(),
							editable : false,
							listeners : {
								'select' : function() {
									Ext.getCmp('orderManager_startDate')
											.setMaxValue(this.getValue());
								}
							}
						}]
					}, {
						columnWidth : .25,
						layout : 'form',
						border : false,
						items : [{
									id : 'orderManager_orderTypesMultiCmb',
									xtype : 'dataDictionaryMultiCmb',
									anchor : '100%',
									fieldLabel : "订单类型",
									editable : false,
									autoLoad : false,
									hiddenValueId : 'orderManager_orderType',
									dictionaryType : PmsUtil.order_type
								}]
					}, {
						id : 'orderManager_orderType',
						xtype : 'hidden',
						name : 'orderTypes'
					}, {
						columnWidth : .25,
						layout : 'form',
						border : false,
						items : [{
									id : 'orderManager_couponTypesMultiCmb',
									xtype : 'dataDictionaryMultiCmb',
									anchor : '100%',
									fieldLabel : "优惠类型",
									editable : false,
									autoLoad : false,
									hiddenValueId : 'orderManager_couponType',
									dictionaryType : PmsUtil.order_coupon_type
								}]
					}, {
						id : 'orderManager_couponType',
						xtype : 'hidden',
						name : 'couponTypes'
					}]
				}, {
					layout : 'column',
					border : false,
					items : [{
						columnWidth : .25,
						layout : 'form',
						border : false,
						items : [{
							xtype : 'datefield',
							fieldLabel : '配送开始时间',
							editable : false,
							format : "Y-m-d",
							anchor : "100%",
							id : 'orderManger_startDate',
							name : "deliveryDateStart",
							listeners : {
								'select' : function() {
									Ext.getCmp('orderManger_endDate')
											.setMinValue(this.getValue());
								}
							}
						}]
					}, {
						columnWidth : .25,
						layout : 'form',
						border : false,
						items : [{
							xtype : 'datefield',
							fieldLabel : '配送结束时间',
							editable : false,
							format : "Y-m-d",
							anchor : "100%",
							// width : 175,
							id : 'orderManger_endDate',
							name : "deliveryDateEnd",
							listeners : {
								'select' : function() {
									Ext.getCmp('orderManger_startDate')
											.setMaxValue(this.getValue());
								}
							}
						}]
					}, {
						columnWidth : .25,
						layout : 'form',
						border : false,
						items : [{
							layout : 'column',
							border : false,
							items : [{
										text : '查询',
										xtype : 'button',
										width : 70,
										handler : function() {
											queryOrders();
										},
										style : {
											marginLeft : "100px",
											marginRight : "10px"
										}
									}, {
										text : '重置',
										xtype : 'button',
										width : 70,
										handler : function() {
											queryOrderForm.getForm().reset();
											Ext
													.getCmp("orderManager_orderStatusMultiCmb")
													.reset();
											Ext
													.getCmp("orderManager_payTypesMultiCmb")
													.reset();
											Ext
													.getCmp("orderManager_orderTypesMultiCmb")
													.reset();
											Ext
													.getCmp("orderManager_couponTypesMultiCmb")
													.reset();
											Ext
													.getCmp("orderManager_startDate")
													.setValue('');
											Ext.getCmp("orderManager_endDate")
													.setValue('');
										}
									}]
						}]
					}, {}]
				}]
	});
	fieldSetListeners(['queryOrdersFieldSet', 'queryOrderForm',
					'orderManagerGrid'], [0.26, 0.74]);

	var queryOrderForm = new Ext.form.FormPanel({
				id : 'queryOrderForm',
				anchor : '100% 26%',
				frame : true,
				labelAlign : 'right',
				bodyBorder : false,
				items : [queryOrdersFieldSet]
			});
	return queryOrderForm;
};

/**
 * grids
 */

var orderManagerGrid = function() {
	var orderManagerSm = new Ext.grid.CheckboxSelectionModel();// 创建选择模式对象
	// 定义表的每列（对应表头信息）
	var orderManagerCm = new Ext.grid.ColumnModel([orderManagerSm,
			new Ext.grid.RowNumberer(), {
				dataIndex : "id",
				header : "订单编号",
				sortable : false,
				width : 70
			}, {
				dataIndex : "orderCode",
				header : "订单编码",
				sortable : false,
				width : 160,
				renderer : function(value, cellmeta, record, rowIndex,
						columnIndex, store) {
					var returnValue = "";
					var orderId = record.data.id;
					if (value) {
						returnValue = '<a href ="#" onClick="lookOrderManagerDetail(\''
								+ orderId + '\')">' + value + '</a>';
					}
					return returnValue;
				}
			}, {
				dataIndex : "userId",
				header : "用户编号",
				sortable : false,
				width : 70
			}, {
				dataIndex : "userName",
				header : "用户姓名",
				sortable : false,
				width : 70
			},
			// {
			// dataIndex : "userPaymentId",
			// header : "支付流水号",
			// sortable : false,
			// width : 80
			// },
			{
				dataIndex : "orderType",
				header : "订单类型",
				sortable : false,
				width : 60,
				renderer : function(value) {
					return PmsUtil.OrderType(value);
				}
			},
			// {
			// dataIndex : "orderSource",
			// header : "订单来源",
			// sortable : false,
			// width : 80,
			// renderer : function(value) {
			// return PmsUtil.OrderSource(value);
			// }
			// },
			{
				dataIndex : "orderStatus",
				header : "订单状态",
				sortable : false,
				width : 60,
				renderer : function(value) {
					return PmsUtil.OrderStatus(value);
				}
			}, {
				dataIndex : "payStatus",
				header : "支付状态",
				sortable : false,
				width : 60,
				renderer : function(value) {
					return PmsUtil.OrderPayStatus(value);
				}
			}, {
				dataIndex : "payType",
				header : "支付方式",
				sortable : false,
				width : 60,
				renderer : function(value) {
					return PmsUtil.PayType(value);
				}
			},
			// {
			// dataIndex : "payDate",
			// header : "支付时间",
			// sortable : false,
			// width : 130
			// }, {
			// dataIndex : "limitPayDate",
			// header : "支付期限时间",
			// sortable : false,
			// width : 130
			// },
			{
				dataIndex : "goodsNumber",
				header : "商品数量",
				sortable : false,
				width : 70
			}, {
				dataIndex : "totalAmount",
				header : "订单总金额",
				sortable : false,
				width : 70,
				renderer : function(val) {
					return PmsUtil.Price(val);
				}
			}, {
				dataIndex : "payAmount",
				header : "实际支付金额",
				sortable : false,
				width : 90,
				renderer : function(val) {
					return '<font color=\"#FF0000\" >' + PmsUtil.Price(val)
							+ '</font>';
				}
			}, {
				dataIndex : "couponFee",
				header : "优惠券金额",
				sortable : false,
				width : 80
			}, {
				dataIndex : "deliveryDate",
				header : "配送日期",
				sortable : false,
				width : 90,
				renderer : function(date) {
					return '<font color=\"#FF0000\" >'
							+ Ext.util.Format.substr(date, 0, 10) + '</font>';
				}
			}, {
				dataIndex : "deliveryTimes",
				header : "配送时间段",
				sortable : false,
				width : 80,
				renderer : function(value) {
					return '<font color=\"#FF0000\" >' + value + '</font>';
				}
			}, {
				dataIndex : "deliveryFee",
				header : "配送费用",
				sortable : false,
				width : 70,
				renderer : function(val) {
					return PmsUtil.Price(val);
				}
			},
			// {
			// dataIndex : "logisticNo",
			// header : "物流单号",
			// sortable : false,
			// width : 70
			// },
			{
				dataIndex : "couponType",
				header : "优惠类型",
				sortable : false,
				width : 100,
				renderer : function(value) {
					return PmsUtil.CouponType(value);
				}
			}, {
				dataIndex : "couponId",
				header : "优惠ID",
				sortable : false,
				width : 50
			}, {
				dataIndex : "couponCode",
				header : "优惠码",
				sortable : false,
				width : 80
			}, {
				dataIndex : "couponSource",
				header : "优惠来源",
				sortable : false,
				width : 120,
				renderer : function(value, meta, record) {
					if (value) {
						meta.attr = 'ext:qtitle="优惠来源:" ext:qtip="' + value
								+ '"';
						return value;
					}
				}
			}, {
				dataIndex : "consignee",
				header : "收货人",
				sortable : false,
				width : 70
			}, {
				dataIndex : "consignPhone",
				header : "收货人电话",
				sortable : false,
				width : 100
			}, {
				dataIndex : "consignAddress",
				header : "收货人地址",
				sortable : false,
				width : 130,
				renderer : function(value, meta, record) {
					if (value) {
						meta.attr = 'ext:qtitle="收货人地址:" ext:qtip="' + value
								+ '"';
						return value;
					}
				}
			}, {
				dataIndex : "birthdayCard",
				header : "生日卡片",
				sortable : false,
				width : 100,
				renderer : function(value, meta, record) {
					if (value) {
						meta.attr = 'ext:qtitle="生日卡片:" ext:qtip="' + value
								+ '"';
						return value;
					}
				}
			}, {
				dataIndex : "companyName",
				header : "试吃公司名称",
				sortable : false,
				width : 100
			}, {
				dataIndex : "applyUserName",
				header : "试吃申请人",
				sortable : false,
				width : 100
			}, {
				dataIndex : "applyUserPhone",
				header : "试吃申请人电话",
				sortable : false,
				width : 100
			}, {
				dataIndex : "companyScale",
				header : "公司规模",
				sortable : false,
				width : 100
			}, {
				dataIndex : "remark",
				header : "备注",
				sortable : false,
				width : 100,
				renderer : function(value, meta, record) {
					if (value) {
						meta.attr = 'ext:qtitle="备注:" ext:qtip="' + value + '"';
						return value;
					}
				}
			}, {
				dataIndex : "isNeedInvoice",
				header : "是否需要发票",
				sortable : false,
				width : 120,
				renderer : function(value) {
					if (value == '1') {
						return '<font color=\"#FF0000\" >'
								+ PmsUtil.isNeedInvoice(value) + '</font>';
					}
					return PmsUtil.isNeedInvoice(value);
				}
			}, {
				dataIndex : "invoiceTitle",
				header : "发票抬头",
				sortable : false,
				width : 100,
				renderer : function(value, meta, record) {
					if (value) {
						meta.attr = 'ext:qtitle="发票抬头:" ext:qtip="' + value
								+ '"';
						return value;
					}
				}
			}, {
				dataIndex : "invoiceContent",
				header : "发票内容",
				sortable : false,
				width : 100,
				renderer : function(value, meta, record) {
					if (value) {
						meta.attr = 'ext:qtitle="发票内容:" ext:qtip="' + value
								+ '"';
						return value;
					}
				}
			}, {
				dataIndex : "cancelDate",
				header : "取消日期",
				sortable : false,
				width : 130
			}, {
				dataIndex : "cancelReason",
				header : "取消原因",
				sortable : false,
				width : 130,
				renderer : function(value, meta, record) {
					if (value) {
						meta.attr = 'ext:qtitle="取消原因:" ext:qtip="' + value
								+ '"';
						return value;
					}
				}
			}, {
				dataIndex : "cancelName",
				header : "取消人",
				sortable : false,
				width : 70
			}, {
				dataIndex : "refundsReason",
				header : "退款/拒收原因",
				sortable : false,
				width : 130,
				renderer : function(value, meta, record) {
					if (value) {
						meta.attr = 'ext:qtitle="退款/拒收原因:" ext:qtip="' + value
								+ '"';
						return value;
					}
				}
			}, {
				dataIndex : "createdDate",
				header : "创建时间",
				sortable : false,
				width : 130
			}, {
				dataIndex : "createdName",
				header : "创建人",
				sortable : false,
				width : 70
			}, {
				dataIndex : "receivedDate",
				header : "确认收货时间",
				sortable : false,
				width : 140
			}, {
				header : "管理",
				width : 100,
				dataIndex : "id",
				renderer : function(j, i, g, m, h) {
					var orderId = g.data.id;
					var k = "";
					if (isGranted("orderManager_物流状态")) {
						k += '&nbsp;&nbsp;<a href="#" onclick="managerLookLogisticStatus('
								+ orderId + ')\">物流状态</a>';
					}
					return k;
				}
			}]);

	// 定义分析器
	var orderManagerReader = new Ext.data.JsonReader({
				totalProperty : "totalCount",
				root : "list",
				fields : [{
							name : "id"
						}, {
							name : "orderCode"
						}, {
							name : "userId"
						}, {
							name : "userName"
						}, {
							name : "userPaymentId"
						}, {
							name : "orderStatus"
						}, {
							name : "payStatus"
						}, {
							name : "payType"
						}, {
							name : "orderSource"
						}, {
							name : "payDate"
						}, {
							name : "limitPayDate"
						}, {
							name : "totalAmount"
						}, {
							name : "goodsNumber"
						}, {
							name : "payAmount"
						}, {
							name : "deliveryDate"
						}, {
							name : "deliveryTimes"
						}, {
							name : "deliveryFee"
						}, {
							name : "couponType"
						}, {
							name : "couponCode"
						}, {
							name : "couponId"
						}, {
							name : "couponFee"
						}, {
							name : "couponSource"
						}, {
							name : "consignee"
						}, {
							name : "consignPhone"
						}, {
							name : "consignAddress"
						}, {
							name : "birthdayTitle"
						}, {
							name : "birthdayCard"
						}, {
							name : "companyName"
						}, {
							name : "applyUserName"
						}, {
							name : "applyUserPhone"
						}, {
							name : "companyScale"
						}, {
							name : "remark"
						}, {
							name : "isNeedInvoice"
						}, {
							name : "invoiceContent"
						}, {
							name : "invoiceTitle"
						}, {
							name : "payGoodsName"
						}, {
							name : "cancelDate"
						}, {
							name : "cancelReason"
						}, {
							name : "createdDate"
						}, {
							name : "createdName"
						}, {
							name : "updatedDate"
						}, {
							name : "updatedName"
						}, {
							name : "cancelName"
						}, {
							name : "receivedDate"
						}, {
							name : "refundsReason"
						}, {
							name : "logisticNo"
						}, {
							name : 'orderCreateStartDate'
						}, {
							name : 'orderCreateEndDate'
						}, {
							name : 'orderType'
						}]
			});

	// 取数据store
	var orderViewStore = new Ext.data.Store({
				// autoLoad : true,// 要加载数据必须设置为true
				proxy : new Ext.data.HttpProxy({
							url : __ctxPath + "/orderManager/selectOrders"
						}),
				remoteSort : true,
				baseParams : {
					start : 0,
					limit : 25
				},
				listeners : {
					beforeload : {
						fn : function(thiz, options) {
							Ext.apply(thiz.baseParams, Ext
											.getCmp('queryOrderForm').getForm()
											.getValues());
						}
					}
				},
				reader : orderManagerReader
			});
	orderViewStore.setDefaultSort("od.id", "desc");
	var orderManagerTb = new Ext.Toolbar({// 定义grid的toolbar
		height : 25,
		items : []
	});

	orderManagerTb.add(new Ext.scm.Button({
				text : "新增订单",
				iconCls : "btn-add",
				width : 80,
				pressed : true,
				hsValue : "orderManager_新增订单",
				listeners : {
					"click" : function() {
						addOrder();
					}
				}
			}));

	orderManagerTb.add(new Ext.scm.Button({
				text : "导出excel",
				iconCls : "btn-excel",
				width : 80,
				pressed : true,
				hsValue : "orderManager_批量导出",
				listeners : {
					"click" : function() {
						exportOrdersToExcel();
					}
				}
			}));

	orderManagerTb.add(new Ext.Toolbar.Spacer());
	orderManagerTb.add(new Ext.scm.Button({
				text : "刷 新",
				width : 80,
				iconCls : "btn-refresh",
				hsValue : "orderManager_刷新",
				pressed : true,
				handler : function() {
					queryOrders();
				}
			}));

	var orderManagerGrid = new Ext.grid.GridPanel({
				id : 'orderManagerGrid',
				store : orderViewStore,
				cm : orderManagerCm,
				sm : orderManagerSm,
				autoScroll : true,
				loadMask : true,
				stripeRows : true,
				columnLines : true,
				loadMask : {
					msg : "正在加载数据，请稍侯……"
				},
				viewConfig : {
					emptyText : '没有您想要的数据!'
				},
				anchor : '100% 74%',
				frame : true,
				tbar : orderManagerTb,
				bbar : new PG.PagingBar({
							store : orderViewStore,
							isShowTwoHunder : true
						})
			});
	return orderManagerGrid;
};

/**
 * 查询物流状态列表
 * 
 * @param {}
 *            id
 */
function managerLookLogisticStatus(id) {
	var centerPanel = App.getContentPanel();
	var tab = centerPanel.getItem(PmsUtil.LOGISTIC_STATUS);
	var createNewTab = new CreatNewTab(PmsUtil.LOGISTIC_STATUS, '物流状态');
	if (tab == null) {
		createNewTab.createNew(tab);
	} else {
		createNewTab.createOld(tab, ['logisticStatusGrid']);
	}
	Ext.Loader.load([__ctxPath + '/js/order/logisticStatus.js'], function() {
		Ext.getCmp("centerTabPanel").getActiveTab().add(logisticStatusGrid(id));
		Ext.getCmp("centerTabPanel").getActiveTab().doLayout();
	});
}

// 查询
function queryOrders() {
	var grid = Ext.getCmp("orderManagerGrid");
	var form = Ext.getCmp("queryOrderForm");
	if (form.getForm().isValid()) {
		grid.getStore().load();
	}
}

// 修改
function updateOrder(orderId) {
	try {
		updateOrderWin(orderId).show();
	} catch (Error) {
		Ext.Loader.load([__ctxPath + '/js/order/orderForm.js'], function() {
					updateOrderWin(orderId).show();
				});
	}
}

// 发货
function stockSend(orderId) {
	try {
		stockSendWin(orderId).show();
	} catch (Error) {
		Ext.Loader.load([__ctxPath + '/js/order/stockSendForm.js'], function() {
					stockSendWin(orderId).show();
				});
	}

}

// 取消订单
function canelOrder(orderId) {
	try {
		cancelOrderWin(orderId).show();
	} catch (Error) {
		Ext.Loader.load([__ctxPath + '/js/order/cancelOrderForm.js'],
				function() {
					stcancelOrderWinockSendWin(orderId).show();
				});
	}
}
/**
 * 查看订单详情
 * 
 * @param {}
 *            id
 */
function lookOrderManagerDetail(id) {
	var centerPanel = App.getContentPanel();
	var tab = centerPanel.getItem(PmsUtil.ORDER_MESSAGE_DETAIL);
	var createNewTab = new CreatNewTab(PmsUtil.ORDER_MESSAGE_DETAIL, '订单详情');
	if (tab == null) {
		createNewTab.createNew(tab);
	} else {
		createNewTab.createOld(tab, ['lookOrderDetailFields',
						'lookOrderDetailForm', 'lookOrderDetailGrid']);
	}
	Ext.Loader.load([__ctxPath + '/js/order/orderDetail.js'], function() {
				Ext.getCmp("centerTabPanel").getActiveTab().add(
						lookOrderDetailSearch(id), orderDetailGrid(id));
				Ext.getCmp("centerTabPanel").getActiveTab().doLayout();
			});
}
// 订单的excel导出
function exportOrdersToExcel() {
	var d = Ext.getCmp("orderManagerGrid");
	var jsonrecord = d.getSelectionModel().getSelections();
	if (jsonrecord.length == 0) {
		Ext.MessageBox.show({
					title : "操作信息",
					msg : "请选择要导出的订单!",
					buttons : Ext.MessageBox.OK,
					icon : Ext.MessageBox.WARNING
				});
		return;
	}

	var orderIds = "";
	var m = 0;
	for (var i = 0; i < jsonrecord.length; i++) {
		var tmp = jsonrecord[i];
		if (m > 0) {
			orderIds = orderIds + "," + tmp.data.id;
		} else {
			orderIds = tmp.data.id;
		}
		m++;
	}
	Ext.Msg.confirm("信息确认", "是否批量导出订单数据？", function(btn) {
				if (btn == 'yes') {
					document.location.href = __ctxPath
							+ "/orderManager/exportOrdersToExcel?orderIds="
							+ orderIds;
				}

			});
};
/**
 * 公共获取时间
 * 
 * @param {}
 *            AddDayCount
 * @return {}
 */
function GetDateStr(AddDayCount) {
	var s;
	var systemDate = new Date();
	systemDate.setDate(systemDate.getDate() + AddDayCount);// 获取AddDayCount天后的日期
	s = systemDate.getFullYear() + "-"; // 取年份
	var strMonth = (systemDate.getMonth() + parseInt(1)).toString();
	s = s + ((strMonth.length == 1) ? ("0" + strMonth) : strMonth) + "-";// 取月份
	var strDate = systemDate.getDate().toString();
	s += ((strDate.length == 1) ? ("0" + strDate) : strDate) + " ";// 取日期
	return s;
}
/**
 * 获取昨天日期
 */
function getYesterdayDate() {
	return GetDateStr(-1) + "16:00:00";
}

/**
 * 当前时间
 * 
 * @return {}
 */
function getTodayDate() {
	return GetDateStr(0) + "16:00:00";
};

// 添加
function addOrder() {
	try {
		addGoodsOrder(null, "新增订单").show();
	} catch (Error) {
		Ext.Loader.load([__ctxPath + '/js/order/addOrderForms.js'], function() {
					addGoodsOrder(null, "新增订单").show();
				});
	}
}

Ext.getCmp("centerTabPanel").getActiveTab().add(queryOrderSearch(),
		orderManagerGrid());
Ext.getCmp("centerTabPanel").getActiveTab().doLayout();
